public class Rectangle {
	private Point p1, p2;
	
	/**
	 * Instantiates a new rectangle.
	 *
	 * @param p1 the p1
	 * @param p2 the p2
	 */
	Rectangle(Point p1, Point p2) {
		this.p1 = p1;
		this.p2 = p2;
	}
	
	/**
	 * Gets the width.
	 *
	 * @return the width
	 */
	public Double getWidth() {
		return p2.x - p1.x;
	}
	
	/**
	 * Gets the height.
	 *
	 * @return the height
	 */
	public Double getHeight() {
		return p2.y - p1.y;
	}
	
	/**
	 * Gets the area.
	 *
	 *	Calculate the height and width of the rectangle using the coordinates 
	 *  of the two corner points, then multiply to get the area of the entire 
	 *  figure.
	 *
	 * @return the area
	 */
	public Double getArea() {
		double width = getWidth();
		double height = getHeight();
		return Math.abs(width * height);
	}
	
	/**
	 * Gets the diagonal length.
	 *
	 * Use Pythagorean theorem to generate the length of the diagonal. Use the 
	 * coordinates of the two corner points to derive the width and height of
	 * the rectangle, then raise them to the second power and take the square 
	 * root to find the length of the diagonal line connecting the two points.
	 *
	 * @return the diagonal
	 */
	public Double getDiagonal() {
		double width = getWidth();
		double height = getHeight();
		
		double widthSquared = Math.pow(width, 2);
		double heightSquared = Math.pow(height, 2);
		return Math.sqrt(widthSquared + heightSquared);
	}
}
